﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Top100 : System.Web.UI.Page
{
    static int topid;

    protected void Page_Load(object sender, EventArgs e)
    {
        string topid_s = Request.QueryString["topid"];
        bool t = Int32.TryParse(topid_s, out topid);
        if (t)
        {
            LoadMusicTopHot(topid);
        }
    }

    private void LoadMusicTopHot(int topid)
    {
        Sharemp3DataContext db = new Sharemp3DataContext();

        titleDetails.InnerText = db.TopHots.Where(i => i.TopHotID == topid).First().TopHotName + " Top Music Hot";

        var musiclst = (from i in db.TopHotMusics
                        where i.TopHotID == topid
                        select new
                        {
                            MusicID = i.MusicID,
                            Title = i.Music.Title,
                            AlbumID = i.Music.AlbumID,
                            AlbumName = i.Music.Album.AlbumName,
                            ArtistID = i.Music.Album.ArtistID,
                            ArtistName = i.Music.Album.Artist.ArtistName,
                            Rating = i.Music.Rating,
                            Cover = i.Music.Cover,
                            Date = i.Music.Album.Date,
                            Number = i.number
                        }).OrderBy(i => i.Number);

        Rpt_MusicList.DataSource = musiclst;
        Rpt_MusicList.DataBind();
    }
}